/**
 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.vijayan.profile.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import com.vijayan.profile.model.FamilyMember;
import com.vijayan.profile.model.FamilyMemberModel;
import com.vijayan.profile.model.FamilyMemberSoap;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;

/**
 * The base model implementation for the FamilyMember service. Represents a row in the &quot;kalyan_family_member&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.vijayan.profile.model.FamilyMemberModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link FamilyMemberImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a family member model instance should use the {@link com.vijayan.profile.model.FamilyMember} interface instead.
 * </p>
 *
 * @author vijayan
 * @see FamilyMemberImpl
 * @see com.vijayan.profile.model.FamilyMember
 * @see com.vijayan.profile.model.FamilyMemberModel
 * @generated
 */
public class FamilyMemberModelImpl extends BaseModelImpl<FamilyMember>
	implements FamilyMemberModel {
	public static final String TABLE_NAME = "kalyan_family_member";
	public static final Object[][] TABLE_COLUMNS = {
			{ "memberId", new Integer(Types.BIGINT) },
			{ "profileId", new Integer(Types.BIGINT) },
			{ "memberName", new Integer(Types.VARCHAR) },
			{ "relationship", new Integer(Types.VARCHAR) },
			{ "married", new Integer(Types.BOOLEAN) },
			{ "available", new Integer(Types.BOOLEAN) }
		};
	public static final String TABLE_SQL_CREATE = "create table kalyan_family_member (memberId LONG not null primary key,profileId LONG,memberName VARCHAR(75) null,relationship VARCHAR(75) null,married BOOLEAN,available BOOLEAN)";
	public static final String TABLE_SQL_DROP = "drop table kalyan_family_member";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.vijayan.profile.model.FamilyMember"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.vijayan.profile.model.FamilyMember"),
			true);

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static FamilyMember toModel(FamilyMemberSoap soapModel) {
		FamilyMember model = new FamilyMemberImpl();

		model.setMemberId(soapModel.getMemberId());
		model.setProfileId(soapModel.getProfileId());
		model.setMemberName(soapModel.getMemberName());
		model.setRelationship(soapModel.getRelationship());
		model.setMarried(soapModel.getMarried());
		model.setAvailable(soapModel.getAvailable());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<FamilyMember> toModels(FamilyMemberSoap[] soapModels) {
		List<FamilyMember> models = new ArrayList<FamilyMember>(soapModels.length);

		for (FamilyMemberSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.vijayan.profile.model.FamilyMember"));

	public FamilyMemberModelImpl() {
	}

	public long getPrimaryKey() {
		return _memberId;
	}

	public void setPrimaryKey(long pk) {
		setMemberId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_memberId);
	}

	public long getMemberId() {
		return _memberId;
	}

	public void setMemberId(long memberId) {
		_memberId = memberId;
	}

	public long getProfileId() {
		return _profileId;
	}

	public void setProfileId(long profileId) {
		_profileId = profileId;
	}

	public String getMemberName() {
		if (_memberName == null) {
			return StringPool.BLANK;
		}
		else {
			return _memberName;
		}
	}

	public void setMemberName(String memberName) {
		_memberName = memberName;
	}

	public String getRelationship() {
		if (_relationship == null) {
			return StringPool.BLANK;
		}
		else {
			return _relationship;
		}
	}

	public void setRelationship(String relationship) {
		_relationship = relationship;
	}

	public boolean getMarried() {
		return _married;
	}

	public boolean isMarried() {
		return _married;
	}

	public void setMarried(boolean married) {
		_married = married;
	}

	public boolean getAvailable() {
		return _available;
	}

	public boolean isAvailable() {
		return _available;
	}

	public void setAvailable(boolean available) {
		_available = available;
	}

	public FamilyMember toEscapedModel() {
		if (isEscapedModel()) {
			return (FamilyMember)this;
		}
		else {
			return (FamilyMember)Proxy.newProxyInstance(FamilyMember.class.getClassLoader(),
				new Class[] { FamilyMember.class },
				new AutoEscapeBeanHandler(this));
		}
	}

	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
					FamilyMember.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	public Object clone() {
		FamilyMemberImpl clone = new FamilyMemberImpl();

		clone.setMemberId(getMemberId());
		clone.setProfileId(getProfileId());
		clone.setMemberName(getMemberName());
		clone.setRelationship(getRelationship());
		clone.setMarried(getMarried());
		clone.setAvailable(getAvailable());

		return clone;
	}

	public int compareTo(FamilyMember familyMember) {
		long pk = familyMember.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		FamilyMember familyMember = null;

		try {
			familyMember = (FamilyMember)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = familyMember.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(13);

		sb.append("{memberId=");
		sb.append(getMemberId());
		sb.append(", profileId=");
		sb.append(getProfileId());
		sb.append(", memberName=");
		sb.append(getMemberName());
		sb.append(", relationship=");
		sb.append(getRelationship());
		sb.append(", married=");
		sb.append(getMarried());
		sb.append(", available=");
		sb.append(getAvailable());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(22);

		sb.append("<model><model-name>");
		sb.append("com.vijayan.profile.model.FamilyMember");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>memberId</column-name><column-value><![CDATA[");
		sb.append(getMemberId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>profileId</column-name><column-value><![CDATA[");
		sb.append(getProfileId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>memberName</column-name><column-value><![CDATA[");
		sb.append(getMemberName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>relationship</column-name><column-value><![CDATA[");
		sb.append(getRelationship());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>married</column-name><column-value><![CDATA[");
		sb.append(getMarried());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>available</column-name><column-value><![CDATA[");
		sb.append(getAvailable());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _memberId;
	private long _profileId;
	private String _memberName;
	private String _relationship;
	private boolean _married;
	private boolean _available;
	private transient ExpandoBridge _expandoBridge;
}